/**
 * Created by weikexin .
 * description:
 **/
import { HTTP } from "../util/http";

class Resume extends HTTP {
  resumePublish(params = {}, success) {
    let url = "ResumeManagement/save";
    let data = Object.assign({}, params, {
      userName: wx.getStorageSync("userInfo").user_name || 0,
    });
    this.request({
      url: url,
      method: "POST",
      data: data,
      success,
    });
  }

  delivery(params = {}, success) {
    let url = "ResumeManagement/deliverInfo";
    let data = Object.assign({}, params, {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    });
    this.request({
      url: url,
      method: "POST",
      data: data,
      urlData: data,
      success,
    });
  }

  resumeUpdate(params = {}, success) {
    let url = "ResumeManagement/updateById";
    let data = Object.assign({}, params, {});
    this.request({
      url: url,
      method: "POST",
      data: data,
      urlData: {
        userId: wx.getStorageSync("userInfo").user_id || 0,
      },
      success,
    });
  }

  resumeDetail(success) {
    let url = "ResumeManagement/queryMyResume";
    let data = {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    };
    this.request({
      url: url,
      data: data,
      success,
    });
  }

  resumeDelivery(params = {}, success) {
    let url = "resume/delivery";
    let data = Object.assign({}, params, {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    });
    this.request({
      url: url,
      data: data,
      success,
    });
  }

  getResumeDetail(params = {}, success) {
    let url = "resume/detailById";
    let data = Object.assign({}, params, {});
    this.request({
      url: url,
      data: data,
      success,
    });
  }

  getReceivedResume(params = {}, success) {
    let url = "RecruitManagement/getReceiveResume";
    let data = Object.assign({}, params, {
      count: 10,
    });
    this.request({
      url: url,
      data: data,
      success,
      method: "POST",
    });
  }

  getReceivedRecruit(params = {}, success) {
    let url = "ResumeManagement/getReceiveRecruit";
    let data = Object.assign({}, params, {
      count: 10,
    });
    this.request({
      url: url,
      data: data,
      success,
      method: "POST",
    });
  }

  delete(params = {}, success) {
    let url = "ResumeManagement/deleteById";
    let data = Object.assign({}, params);
    this.request({
      url: url,
      urlData: data,
      success,
      method: "POST",
    });
  }

  getDeliveryResume(params = {}, success) {
    let url = "ResumeManagement/queryResumeList";
    let data = Object.assign(
      {
        userId: wx.getStorageSync("userInfo").user_id || 0,
        count: 10,
      },
      params
    );
    this.request({
      url: url,
      data,
      success,
      method: "POST",
    });
  }

  getDeliveryRecruit(params = {}, success) {
    let url = "RecruitManagement/queryRecruitList";
    let data = Object.assign(
      {
        userId: wx.getStorageSync("userInfo").user_id || 0,
        count: 10,
      },
      params
    );
    this.request({
      url: url,
      data,
      success,
      method: "POST",
    });
  }

  getDeliveryBidding(params = {}, success) {
    let url = "BiddingManagement/queryBiddingList";
    let data = Object.assign(
      {
        userId: wx.getStorageSync("userInfo").user_id || 0,
        count: 10,
      },
      params
    );
    this.request({
      url: url,
      data,
      success,
      method: "POST",
    });
  }

  updateReadState(params = {}, success) {
    let url = "ResumeManagement/updateReadState";
    let data = Object.assign({}, params, {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    });
    this.request({
      url: url,
      data: data,
      success,
    });
  }

  checkCall(params = {}, success) {
    let url = "ResumeManagement/checkWhetherToAllowDialing";
    let data = Object.assign({}, params, {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    });
    this.request({
      url: url,
      urlData: data,
      method: "POST",
      success,
    });
  }

  call(params = {}, success) {
    let url = "ResumeManagement/insertCallResumeRecord";
    let data = Object.assign({}, params, {
      userId: wx.getStorageSync("userInfo").user_id || 0,
    });
    this.request({
      url: url,
      data,
      method: "POST",
      success,
    });
  }
}

export { Resume };
